package com.gitee.wsl.struct.grammar.ast.process.constraints.ext

import com.gitee.wsl.text.reader.line.LookaheadText
import com.gitee.wsl.struct.grammar.ast.process.constraints.TextReadConstraints

fun TextReadConstraints.hasCodeBlockIndent(pos: LookaheadText.Position): Boolean {
    val constraintsLength = getCharsEaten(pos.currentLineText)

    if (pos.offsetInCurrentLine >= constraintsLength + 4) {
        return true
    }

    for (i in constraintsLength..pos.offsetInCurrentLine) {
        if (pos.currentLineText[i] == '\t') {
            return true
        }
    }
    return false
}

fun TextReadConstraints.containsListMarkers(): Boolean {
    return containsListMarkers(types.size)
}

